package com.grf.scala

object SquareMatch {
  def main(args: Array[String]): Unit = {
    val num:Double = 16.0
    num match {
      case Square(n) => println(n)
      case _ => println("Nothing")
    }
  }
}
object Square {
  def unapply(d:Double): Option[Double] = Some(math.sqrt(d))
  def apply(d:Double): Double = d*d
}
